// 管理员路由配置
import AdminLayout from '@/views/admin/layout/AdminLayout.vue'

// 管理员视图组件
const AdminDashboard = () => import('@/views/admin/Dashboard.vue')
const AdminLogin = () => import('@/views/admin/Login.vue')

// 用户管理
const UserManagement = () => import('@/views/admin/user/UserManagement.vue')

// 服装定制管理
const StyleManagement = () => import('@/views/admin/clothing/StyleManagement.vue')
const MaterialManagement = () => import('@/views/admin/clothing/MaterialManagement.vue')
const AccessoryManagement = () => import('@/views/admin/clothing/accessory/AccessoryList.vue')

// 设计师管理
const DesignerQualification = () => import('@/views/admin/designer/DesignerQualification.vue')
const DesignerSchedule = () => import('@/views/admin/designer/DesignerSchedule.vue')
const DesignerQualityMonitor = () => import('@/views/admin/designer/DesignerQualityMonitor.vue')

// 订单管理
const OrderList = () => import('@/views/admin/order/OrderList.vue')
const OrderProcess = () => import('@/views/admin/order/OrderProcess.vue')
const OrderAnalysis = () => import('@/views/admin/order/OrderAnalysis.vue')
const DisputeList = () => import('@/views/admin/order/DisputeList.vue')
const DisputeDetail = () => import('@/views/admin/order/DisputeDetail.vue')

// 个人中心
const AdminProfile = () => import('@/views/admin/profile/AdminProfile.vue')
const SecuritySettings = () => import('@/views/admin/profile/SecuritySettings.vue')

// 库存管理
const FabricInventory = () => import('@/views/admin/inventory/FabricInventory.vue')
const AccessoryInventory = () => import('@/views/admin/inventory/AccessoryInventory.vue')

// 管理员路由
const adminRoutes = [
  {
    path: '/admin/login',
    name: 'AdminLogin',
    component: AdminLogin,
    meta: { title: '管理员登录', requiresAuth: false }
  },
  {
    path: '/admin',
    component: AdminLayout,
    redirect: '/admin/dashboard',
    meta: { requiresAuth: true, roles: ['admin'] },
    children: [
      {
        path: 'dashboard',
        name: 'AdminDashboard',
        component: AdminDashboard,
        meta: { title: '管理员仪表盘', icon: 'Dashboard' }
      },
      // 用户管理
      {
        path: 'user',
        name: 'UserManagement',
        component: UserManagement,
        meta: { title: '用户管理', icon: 'User' }
      },
      // 服装定制管理
      {
        path: 'clothing',
        name: 'ClothingManagement',
        redirect: '/admin/clothing/styles',
        meta: { title: '服装定制管理', icon: 'Clothes' },
        children: [
          {
            path: 'styles',
            name: 'StyleManagement',
            component: StyleManagement,
            meta: { title: '服装款式管理' }
          },
          {
            path: 'materials',
            name: 'MaterialManagement',
            component: MaterialManagement,
            meta: { title: '服装材质管理' }
          },
          {
            path: 'accessories',
            name: 'AccessoryManagement',
            component: AccessoryManagement,
            meta: { title: '服装配饰管理' }
          }
        ]
      },
      // 设计师管理
      {
        path: 'designer',
        name: 'DesignerManagement',
        redirect: '/admin/designer/qualification',
        meta: { title: '设计师管理', icon: 'User' },
        children: [
          {
            path: 'qualification',
            name: 'DesignerQualification',
            component: DesignerQualification,
            meta: { title: '资质审核与信息维护' }
          },
          {
            path: 'schedule',
            name: 'DesignerSchedule',
            component: DesignerSchedule,
            meta: { title: '日程管理' }
          },
          {
            path: 'quality',
            name: 'DesignerQualityMonitor',
            component: DesignerQualityMonitor,
            meta: { title: '服务质量监控与评价' }
          }
        ]
      },
      // 订单管理
      {
        path: 'order',
        name: 'OrderManagement',
        component: () => import('@/views/admin/order/index'),
        redirect: '/admin/order/list',
        meta: { title: '订单管理', icon: 'ShoppingCart' },
        children: [
          {
            path: 'list',
            name: 'OrderList',
            component: OrderList,
            meta: { title: '订单列表' }
          },
          {
            path: 'detail/:id',
            name: 'OrderDetail',
            component: OrderProcess,
            meta: { title: '订单详情', activeMenu: '/admin/order/list' },
            hidden: true
          },
          {
            path: 'analysis',
            name: 'OrderAnalysis',
            component: OrderAnalysis,
            meta: { title: '订单分析' }
          },
          {
            path: 'dispute',
            name: 'DisputeList',
            component: DisputeList,
            meta: { title: '纠纷处理' }
          },
          {
            path: 'dispute/:id',
            name: 'DisputeDetail',
            component: DisputeDetail,
            meta: { title: '纠纷详情', activeMenu: '/admin/order/dispute' },
            hidden: true
          }
        ]
      },
      // 个人中心
      {
        path: 'profile',
        name: 'AdminCenter',
        redirect: '/admin/profile/info',
        meta: { title: '个人中心', icon: 'Setting' },
        children: [
          {
            path: 'info',
            name: 'AdminProfile',
            component: AdminProfile,
            meta: { title: '个人信息管理' }
          },
          {
            path: 'security',
            name: 'SecuritySettings',
            component: SecuritySettings,
            meta: { title: '安全设置' }
          }
        ]
      },
      // 库存管理
      {
        path: 'inventory',
        name: 'Inventory',
        meta: { title: '库存管理' },
        children: [
          {
            path: 'material',
            name: 'MaterialInventory',
            component: () => import('@/views/admin/inventory/MaterialInventory.vue'),
            meta: { title: '面料库存' }
          },
          {
            path: 'accessory',
            name: 'AccessoryInventory',
            component: () => import('@/views/admin/inventory/AccessoryInventory.vue'),
            meta: { title: '配饰库存' }
          }
        ]
      }
    ]
  }
]

export default adminRoutes 